package org.geektimes.configuration.microprofile.config.convert;

/**
 * TODO
 *
 * @author karidyang
 * @since 1.0
 * Date: 2021-05-07
 **/
public class ClassConverter extends AbstractConverter<Class> {
    private final ClassLoader classLoader;

    public ClassConverter() {
        this(Thread.currentThread().getContextClassLoader());
    }

    public ClassConverter(ClassLoader classLoader) {
        this.classLoader = classLoader;
    }

    @Override
    protected Class doConvert(String value) throws Throwable{
        return classLoader.loadClass(value);
    }
}
